import { createRouter, createWebHistory } from 'vue-router'
import Main from '@/layout/main/index.vue'
import Home from '@/views/home/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'main',
      redirect: '/home',
      component: Main,
      children: [
        {
          path: '/home',
          name: 'home',
          component: Home,
        },
        {
          path: '/pscrm',
          name: 'pscrm',
          component: () => import('@/views/pscrm/index.vue'),
        },
      ],
    },
    {
      path: '/sub',
      name: 'sub',
      component: () => import('@/layout/sub/index.vue'),
      children: [
        {
          path: '/sub/form',
          name: 'form',
          component: () => import('@/views/form/index.vue'),
        },
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue'),
    },
  ],
})
export default router
